<?php
//云推送
namespace Home\Controller;
use Think\Controller;
class PushController extends CommonController {
	
    public function index(){		
   		$this->redirect("pushService");
    }
	//推送文案
    public function pushService(){

        //获取套餐
        $pushPackage=M("push_package")->select();
        $this->assign("pushPackage",$pushPackage);

		$this->display();
    }


    //推送文案-提交表单
    public function pushServiceForm(){
     
        $map=I("post.");
        
        $pushModel=D("Admin/push_order");
        $res=$pushModel->editData($map,$_FILES);

        if($res){
            $this->success();
        }else{
            $this->error($pushModel->getError(),$_SERVER["HTTP_REFERER"]);
        }
    }

    //推送文案详情
    public function pushDetails(){

       
        $id=I("get.id");

        if($id>0){

            $push=D("Admin/pushOrder")->getPushById($id);    
            $this->assign("push",$push);
            $this->display();
        }else{
            $this->error("参数错误");
        }
    }


	//推送文案列表
    public function pushList(){

        $pushModel=D("Admin/push_order");
        
        $comList=$pushModel->getPushList();

        $this->assign("pushList",$comList["comList"]);
        $this->assign("page",$comList["page"]);
        
        //审核，完成状态
        $status=getPushStatus();
        $this->assign("applyStatus",$status["apply"]);
        $this->assign("okStatus",$status["ok"]);

        
        $this->display();
    }
}